﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _10_ref_param
{
    class Program
    {
        //实现int.TryParse();
        static void Main(string[] args)
        {
            double salary = 4000; //ref参数必须在函数外赋值， 在方法内可以不赋值
            addSalary(ref salary);

            Console.WriteLine(salary);
            Console.ReadKey();
        }

        public static bool MyTryParse(string str, out int num)
        {
            try
            {
                num = Convert.ToInt32(str);
                return true;
            }
            catch
            {
                num = 0;
                return false;
            }
        }

        public static void addSalary(ref double s)
        {
            s += 500;
        }
    }
}
